package org.example.memora.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.example.memora.entity.PostHashtag;

import java.util.List;

public interface PostHashtagMapper extends BaseMapper<PostHashtag> {
    @Insert({
            "<script>",
            "INSERT INTO post_hashtags (post_id, hashtag_id, created_at) VALUES ",
            "<foreach collection='list' item='item' separator=','>",
            "(#{item.postId}, #{item.hashtagId}, #{item.createdAt})",
            "</foreach>",
            "</script>"
    })
    void insertBatch(@Param("list") List<PostHashtag> list);
}
